package model.boundary;

import exceptions.LockedDoorException;

abstract public class Boundary {
	
	protected String type;
	protected String description="";
	public abstract String getType();
	public abstract String getDescription();
	protected String status;
	
	public abstract String getStatus();
	
	public void addDescription(String description){
		this.description=description;
	}
	
		
	public boolean unlock(){
		if(status.equals("LOCKED")){
			status="CLOSED";
			return true;
		}
		return false;	
	}
	
	public boolean openAndClose(boolean open) throws LockedDoorException{
		
		if(open){
			if (status=="CLOSED"){
				status="OPEN";
			return true;
			}
			else if (status=="LOCKED")
				throw new LockedDoorException();
			return false;
		}
		else{
			if(status=="OPEN"){
				status="CLOSED";
			return true;
			}
			else if (status=="LOCKED")
				throw new LockedDoorException();
			return false;
		}
	}

	
	
}
